package topday1_9.demo5;

/**
 * @Auther:小陈的Java
 * 对象类型转换
 */
public class Father2 {
    public void have() {
        System.out.println("我有一头小毛驴，我从来也不骑");
    }
}
class Son2 extends Father2{
    String name = "子类";
    public void method1(){
        System.out.println("子类独有的方法");
    }
    public void have() {
        System.out.println("驴肉火烧，驴肉宴，好吃不贵");
    }

    public static void main(String[] args) {
        Father2 father2 = new Son2();
        if(father2 instanceof  Son2){
            Son2 son2 = (Son2)father2;
        }
    }
}

